//通过connect把state和dispatch 通过props属性垂直映射到ui组件
import {connect} from 'react-redux';
import Discovery from '../components/search'
import {getProducts} from '../action'
//1.映射state

const mapStateToProps=(state)=>{
    return {
        foo:state.searchReducer.foo,
        all:state.searchReducer.all
    }
}

//2.映射dispatch

const mapDispatchToProps=(dispatch)=>{
    return {
        //此处定义一个方法 此方法会垂直 映射到ui组件里面
        getProducts(){
            dispatch(getProducts())
        }
    }
}


let DiscoveryContainer=connect(mapStateToProps,mapDispatchToProps)(Discovery)

export default DiscoveryContainer